<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        Ajax Framework - <span class="subitem">Dropdown</span>
    </ui:define>

    <ui:define name="description">
        Dependent dropdowns implemented with p:ajax behavior.
    </ui:define>

    <ui:param name="documentationLink" value="/ajax/rendering" />

    <ui:define name="implementation">
        
        <h:form>
            <p:growl id="msgs" showDetail="true" skipDetailIfEqualsSummary="true" />

            <p:panel header="Select a Location" style="margin-bottom:10px;">
                <h:panelGrid columns="2" cellpadding="5">
                    <p:outputLabel for="country" value="Country: " />
                    <p:selectOneMenu id="country" value="#{dropdownView.country}" style="width:150px">
                        <p:ajax listener="#{dropdownView.onCountryChange}" update="city" />
                        <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                        <f:selectItems value="#{dropdownView.countries}" />
                    </p:selectOneMenu>

                    <p:outputLabel for="city" value="City: " />
                    <p:selectOneMenu id="city" value="#{dropdownView.city}" style="width:150px">
                        <f:selectItem itemLabel="Select City" itemValue="" noSelectionOption="true" />
                        <f:selectItems value="#{dropdownView.cities}" />
                    </p:selectOneMenu>
                </h:panelGrid>

                <p:separator />

                <p:commandButton value="Submit" update="msgs" action="#{dropdownView.displayLocation}" icon="pi pi-check" />
            </p:panel>
        </h:form>
        
    </ui:define>

</ui:composition>